// 导入vue-router
import { createRouter, createWebHistory } from "vue-router";

// 导入组件
import LoginVue from "@/view/Login.vue";
import LayoutVue from "@/view/Layout.vue";
import ArticalCategoryVue from "@/view/article/ArticleCategory.vue";
import ArticalManageVue from "@/view/article/ArticleManage.vue";
import UserInfoVue from "@/view/user/UserInfo.vue";
import UserAvatarVue from "@/view/user/UserAvatar.vue";
import UserResetPwdVue from "@/view/user/UserResetPassword.vue";

// 定义路由关系
const routes = [
  { path: "/login", component: LoginVue },
  {
    path: "/",
    component: LayoutVue,
    redirect: "/article/manage",
    children: [
      { path: "/article/category", component: ArticalCategoryVue },
      { path: "/article/manage", component: ArticalManageVue },
      { path: "/user/info", component: UserInfoVue },
      { path: "/user/avatar", component: UserAvatarVue },
      { path: "/user/password", component: UserResetPwdVue },
    ],
  },
];

// 创建路由器
const router = createRouter({
  history: createWebHistory(),
  routes: routes,
});

export default router;
